<template>
  <div class="app-container">
    <div class="export-top">
      <div class="gold-number">
        <p class="title">29g足金纪念金牌库存数</p>
        <p class="value">{{redPacket.bigPrizeCount}}</p>
      </div>
      <div class="redpacket-29">
        <p class="title">29元现金红包库存数</p>
        <p class="value">{{redPacket.redbag2900Count}}</p>
      </div>
      <div class="redpacket-29-point">
        <p class="title">2.9元现金红包库存数</p>
        <p class="value">{{redPacket.redbag290Count}}</p>
      </div>
      <div class="redpacket-9-point">
        <p class="title">0.5元现金红包库存数</p>
        <p class="value">{{redPacket.redbag50Count}}</p>
      </div>
    </div>
    <div class="export-bottom">
      <div class="export-day" @click="exposeExcel('day')"><p>导出日报</p></div>
      <div class="export-week" @click="exposeExcel('week')">
        <p>导出周报</p>
      </div>
    </div>
    <!-- 弹出窗口 -->
    <el-dialog
      v-model="exposeShow"
      :title="title"
      width="1000px"
      append-to-body
      :visible.sync="open"
      @close="cancel"
    >
      <div class="export-item">
        接收人：
        <el-input
          v-model="exportForm.exposeName"
          placeholder="请输入接收人,多个请以,分割"
          type="textarea"
        />
      </div>
      <div class="export-item">
        抄送人：
        <el-input
          v-model="exportForm.exposeCopyName"
          placeholder="请输入抄送人,多个请以,分割"
          type="textarea"
        />
      </div>
      <template #footer>
        <!-- 取消和确认按钮 -->
        <div class="footer-button">
          <el-button @click="cancel">取消</el-button>
          <el-button
            v-loading.fullscreen.lock="fullscreenLoading"
            type="primary"
            @click="confirmExport"
            >确定导出</el-button
          >
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { getStatistic,getDailyEmail,getWeeklyEmail } from "@/api/export/index";
export default {
  name: "Role",
  dicts: ["sys_normal_disable"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      //   是否弹出层
      open: false,
      // 弹出show
      exposeShow: false,
      // 弹出标题
      title: "",
      // 导出人
      exportForm: {
        exposeName: "",
        exposeCopyName: "",
      },
      // 导出loading
      fullscreenLoading: false,
      // 红包汇总数据
      redPacket:{
        redbag50Count:'',
        redbag290Count:'',
        redbag2900Count:'',
        bigPrizeCount:''
      }
    };
  },
  created() {
    this.getStaticNum()
  },
  methods: {
    // 查询库存
    getStaticNum(){
      getStatistic().then((res)=>{
        if(res.code==200){
          this.redPacket = res.data
        }
      })
    },
    exposeExcel(type) {
      this.title = "接收邮箱";
      this.exposeShow = true;
      this.open = true;
    },
    confirmExport() {
      this.fullscreenLoading = true;
      setTimeout(() => {
        this.fullscreenLoading = false;
      }, 2000);
    },
    cancel() {
      this.open = false;
      this.exposeShow = false;
      this.exportForm = {
        exposeName: "",
        exposeCopyName: "",
      };
    },
  },
};
</script>

<style scoped lang="scss">
.app-container{
 width: 100%;
 overflow-x: scroll;
}
.export-top {
  display: flex;
  width: 1700px;
  height: 300px;
  justify-content: space-around;
  align-items: center;
  .gold-number {
    width: 300px;
    height: 240px;
    background: #ff8686;
    border-radius: 30px;
    padding: 60px;
  }
  .title {
    color: #fff;
    font-size: 26px;
  }
  .value {
    color: #fff;
    font-size: 30px;
    font-weight: bold;
  }
  .redpacket-29 {
    width: 300px;
    height: 240px;
    background: #998eff;
    border-radius: 30px;
    padding: 60px;
  }
  .redpacket-29-point {
    width: 300px;
    height: 240px;
    background: #2de796;
    border-radius: 30px;
    padding: 60px;
  }
  .redpacket-9-point {
    width: 300px;
    height: 240px;
    background: #fddb20;
    border-radius: 30px;
    padding: 60px;
  }
}
.export-bottom {
  display: flex;
  width: 1600px;
  height: 300px;
  justify-content: space-around;
  .export-day {
    width: 600px;
    height: 240px;
    background: #2e3033;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
  }
  .export-week {
     width: 600px;
    height: 240px;
    background: #2e3033;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
  }
}
.export-item {
  width: 100%;
  height: 120px;
}
.footer-button {
  width: 100%;
  display: flex;
  justify-content: center;
  height: 40px;
  > button {
    width: 220px;
  }
}
</style>
